﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CFlores
{
    public partial class CadClientes : UserControl
    {
        FormPrincipal frmPrincipal;
        int IDCliente;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="frm">Ponteiro do formulario principal</param>  
        public CadClientes(FormPrincipal frm)
        {
            InitializeComponent();
            frmPrincipal = frm;
        }
        private void CadClientes_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            frmPrincipal.ConnPrin.ExecSql("INSERT INTO CLIENTES VALUES(" 
                                          + Convert.ToString(frmPrincipal.ConnPrin.GetID("clientes","idClientes")) + ", '"
                                          + txtNome.Text + "', '"
                                          + txtEndereco.Text + "', '"
                                          + txtTelefone.Text + "', '"
                                          + txtCEP.Text + "', '"
                                          + txtEmail.Text + "')");
            frmPrincipal.FechaAba();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (btnLock.ImageIndex == 2)
            {
                btnLock.ImageIndex = 1;
            }
            else
            {
                btnLock.ImageIndex = 2;
            }
        }
    }
}
